Task References

On this page:

convertTimeToEpoch (time)

Purpose

The convertTimeToEpoch task converts a date/timestamp to Epoch Time, which is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

Potential Use Case

Use this task reference if a workflow is designed to provide an input timestamp to a downstream interface or system that requires the Epoch Time format.

Properties

Input and output properties are shown below.

Incoming Type Description
inputTime Object Required. The date/timestamp to convert.
EpochFormat Enum Required. Represents the Epoch format in which the inputTime is converted. Allowed values are "Seconds" or "Milliseconds".


Outgoing Type Description
epochTime Number The converted date/timestamp value since January 1, 1970 (midnight UTC/GMT). Reformatted into "Seconds" or "Milliseconds" (as designated by the EpochFormat property).

Example 1

In this IAP example:

  • The inputTime variable is provided by the output of getTime, a reference task located elsewhere in the workflow. The reference variable provided by the getTime task is time.

  • The EpochFormat property variable is set to Seconds.

  • For this example, the epochTime value produced upon output will be the value of the inputTime in the format of seconds since January 1, 1970.

    convertTimeToEpoch01

Example 2

In this IAP example:

  • The inputTime variable is provided by the output of getTime, a reference task located elsewhere in the workflow. The reference variable provided by the getTime task is time.

  • The EpochFormat property variable is set to Milliseconds.

  • For this example, the epochTime value produced upon output will be the value of the inputTime in the format of milliseconds since January 1, 1970.

    convertTimeToEpoch02


Manual Reference Variable Entry (inputTime)

To enter the inputTime object manually, use the format below for Year-Month-Date-Time ("yyyy-MM-dd 'T' HH:mm:ss.SSSZ").

{"time": "2021-02-26T15:00:00.000Z"}

This format shows as:

2021-02-25 03:00.00